<%--
  Created by IntelliJ IDEA.
  User: 25673
  Date: 2022/9/24
  Time: 20:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>常见问题管理</title>
  <link rel="stylesheet" href="css/bootstrap.min.css" />
  <link rel="stylesheet" href="css/dashboard.css" />
  <script type="text/javascript" src="js/jquery1.12.4.min.js" ></script>
  <script type="text/javascript" src="js/bootstrap.min.js" ></script>
  <script type="text/javascript" src="js/countUp.js" ></script>
  <style>
    .mo{
      display: none;
      padding: 30px;
      margin-top: 100px;
      width: 400px;
      height: 500px;
      background-color: #fff;
      position: fixed;
      left: 45%;
      top: 40%;
      transform: translate(-50%,-50%);
      box-shadow:5px 6px 15px #666;
    }
    .update{
      color: #00a0df;
    }
    .delete{
      color: #00a0df;
    }
    .content{
      color: #00a0df;
    }
    .cont{
      width: 80px;
      height: 20px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  </style>
  <script>
    $(document).ready(function () {
      $("#insertQuestion").click(function () {
        $("#insertform").show()
      })
      /*编辑*/
      $(".update").click(function () {
        var td = $(this).parent()
        var tds = td.siblings()
        var qno = $(tds[0]).text()
        var qtitle = $(tds[1]).text()
        var qcontent = $(tds[2]).text()
        $("#upqno").val(qno)
        $("#uptitle").val(qtitle)
        $("#upcontent").val(qcontent)
        $("#updateform").show()
      })
      $(".quite").click(function () {
        $(".mo").hide()
      })
      $(".delete").click(function () {
        var qno = $(this).attr('id')
        var is = confirm("确定要删除"+qno+"吗")
        if(is){
          window.location.href="/admin/deleteQuestion?qno="+qno;
        }
      })
      /*详情*/
      $(".content").click(function () {
        var td = $(this).parent()
        var tds = td.siblings()
        var qno = $(tds[0]).text()
        var ntitle = $(tds[1]).text()
        var ncontent = $(tds[2]).text()
        $("#coqno").val(qno)
        $("#cotitle").val(ntitle)
        $("#cocontent").val(ncontent)
        $("#contentQuestion").show()
      })
    })
  </script>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">众筹管理平台</a>
    </div>
    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav navbar-right">
        <li><a href="index.jsp">首页</a></li>
        <li><a href="#">欢迎, ${manage.mname}</a></li>
        <li><a href="#" title="修改个人资料和密码的页面">设置</a></li>
        <li><a href="admin_login.jsp" title="退出登录">退出</a></li>
      </ul>
    </div>
  </div>
</nav>

<div class="container-fluid">
  <div class="row">
    <div class="col-sm-3 col-md-2 sidebar">
      <ul class="nav nav-sidebar">
        <li ><a href="index.jsp">首页</a></li>
      </ul>
      <ul class="nav nav-sidebar">
        <li><a href="/projectManagement/getAll">所有项目*</a></li>
        <li><a href="/projectManagement/getAllNoPro">项目审核</a></li>

        <li><a href="/projectManagement/getAllComment">项目评论</a></li>
        <li><a href="/projectManagement/getAllType">项目分类*</a></li>

      </ul>
      <ul class="nav nav-sidebar">
        <li><a href="/admin/getUsersByCon">注册用户</a></li>
        <li><a href="/admin/getUsersMoney">用户资金</a></li>
        <%--<li><a href="">用户日志</a></li>--%>
        <li><a href="/admin/getUsersReal">实名审核</a></li>
      </ul>
      <ul class="nav nav-sidebar">
        <li><a href="/admin/getNews">新闻管理</a></li>
        <li class="active"><a href="/admin/getQuestion">问题管理</a></li>
        <li><a href="/admin/admin_manage.jsp">管理用户</a></li>
        <%--<li><a href="">管理日志</a></li>--%>
      </ul>
    </div>
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
      <h1 class="page-header">问题管理</h1>
      <div class="panel panel-default">
        <button type="button" class="btn btn-default btn-primary" id="insertQuestion">新增问题</button>
      </div>
      <div class="panel panel-default">
        <div class="panel-heading">
          <div class="panel-title">
            所有问题
          </div>
        </div>
        <div class="panel-body">
          <div class="table-responsive ">
            <table class="table table-striped table-bordered">
              <thead>
              <tr>
                <th>编号</th>
                <th>标题</th>
                <th>内容</th>
                <th>操作</th>
              </tr>
              </thead>
              <tbody>
              <c:forEach items="${pageinfo.list}" var="question">
                <tr>
                  <td>${question.qno}</td>
                  <td>${question.qtitle}</td>
                  <td><div class="cont">${question.qcontent}</div></td>
                  <td>
                    <span class="update">编辑</span>
                    <span class="delete" id="${question.qno}">删除</span>
                    <span class="content">详情</span>
                  </td>
                </tr>
              </c:forEach>
              </tbody>
            </table>
          </div>

          <nav aria-label="Page navigation" class="text-right">

            <ul class="pagination">
              <h3>当前页:${pageinfo.pageNum}</h3>
              <c:if test="${!pageinfo.isFirstPage}">
                <li><a href="/admin/getQuestion?&page=1">首页</a></li>
                <li><a href="/admin/getQuestion?&page=${pageinfo.prePage}">上一页</a></li>
              </c:if>
              <c:forEach items="${pageinfo.navigatepageNums}" var="page">
                <li><a href="/admin/getQuestion?com=${con}&page=${page}">${page}</a> </li>
              </c:forEach>
              <c:if test="${!pageinfo.isLastPage}">
                <li><a href="/admin/getQuestion?&page=${pageinfo.nextPage}">下一页</a></li>
                <li><a href="/admin/getQuestion?&page=${pageinfo.pages}">末页</a></li>
              </c:if>
            </ul>
          </nav>
        </div>
      </div>
    </div>
  </div>
</div>
<div id="insertform" class="mo">
  <h2>新增问题</h2>
  <form class="form-horizontal" method="post" action="/admin/insertQuestion">
    <div class="form-group">
      <label for="qtitle" class="col-sm-2 control-label">标题</label>
      <div class="col-sm-10">
        <input type="text" class="form-control" id="qtitle" placeholder="qtitle" name="qtitle">
      </div>
    </div>
    <div class="form-group">
      <label for="qcontent" class="col-sm-2 control-label">内容</label>
      <div class="col-sm-10">
        <textarea rows="10" type="text" class="form-control" id="qcontent" placeholder="qcontent" name="qcontent"></textarea>
      </div>
    </div>
    <button type="submit" class="btn btn-default">发布</button>
    <button type="button" class="btn btn-default quite">取消</button>
  </form>
</div>

<div class="mo" id="updateform">
  <h2>编辑</h2>
  <form class="form-horizontal" method="post" action="/admin/updateQuestion">
    <div class="form-group">
      <label for="upqno" class="col-sm-2 control-label">编号</label>
      <div class="col-sm-10">
        <input type="text" class="form-control" id="upqno" placeholder="upqno" name="qno" readonly="readonly">
      </div>
    </div>
    <div class="form-group">
      <label for="uptitle" class="col-sm-2 control-label">标题</label>
      <div class="col-sm-10">
        <input type="text" class="form-control" id="uptitle" placeholder="uptitle" name="qtitle">
      </div>
    </div>
    <div class="form-group">
      <label for="upcontent" class="col-sm-2 control-label">内容</label>
      <div class="col-sm-10">
        <textarea rows="10" type="text" class="form-control" id="upcontent" placeholder="upcontent" name="qcontent"></textarea>
      </div>
    </div>
    <button type="submit" class="btn btn-default">更改</button>
    <button type="button" class="btn btn-default quite">取消</button>
  </form>
</div>

<div class="mo" id="contentQuestion">
  <h2>详细信息</h2>
  <form class="form-horizontal">
    <div class="form-group">
      <label for="coqno" class="col-sm-2 control-label">编号</label>
      <div class="col-sm-10">
        <input type="text" class="form-control" id="coqno" placeholder="conno" readonly="readonly">
      </div>
    </div>
    <div class="form-group">
      <label for="cotitle" class="col-sm-2 control-label">标题</label>
      <div class="col-sm-10">
        <input type="text" class="form-control" id="cotitle" placeholder="cotitle" readonly="readonly">
      </div>
    </div>
    <div class="form-group">
      <label for="cocontent" class="col-sm-2 control-label">内容</label>
      <div class="col-sm-10">
        <textarea rows="10" type="text" class="form-control" id="cocontent" placeholder="cocontent" readonly="readonly"></textarea>
      </div>
    </div>
    <button type="button" class="btn btn-default quite">关闭</button>
  </form>
</div>
</body>
</html>

